﻿<template id="@(ViewBag.PageTemplate)">
    <div class="layout-page-content">
        <single_table :api="`${path}/requestsdata`" :pagination="true" :border="true" row-key="Id" :search-columns="searchColumns" ref="tableRef">
            <template #header-left="scope">@(Html.Raw(ViewBag.PageFuncs("tools")))</template>
            <template #default>
                <el-table-column type="selection" fixed="left" width="50" align="center"></el-table-column>

                <el-table-column prop="CreateTime" label="时间" width="180" align="center"></el-table-column>
                <el-table-column prop="Method" label="请求类型" width="100" align="center">
                    <template #default="scope">
                        <el-tag :type="scope.row.Method=='GET'?'success':scope.row.Method=='POST'?'danger':'info'">{{scope.row.Method}}</el-tag>
                    </template>
                </el-table-column>
                <el-table-column prop="Url" label="请求地址" width="350" show-overflow-tooltip></el-table-column>
                <el-table-column prop="UserIp" label="来源IP" width="150" align="center"></el-table-column>
                <el-table-column prop="BrowserType" label="BrowserType" width="200" align="center" show-overflow-tooltip></el-table-column>
                <el-table-column prop="ContentType" label="ContentType" width="200" align="center" show-overflow-tooltip></el-table-column>
                <el-table-column prop="RequestParameter" label="正文内容" width="400" show-overflow-tooltip></el-table-column>
                <el-table-column prop="UserId" label="用户ID" width="150" align="center"></el-table-column>
                <el-table-column prop="Username" label="用户账号" width="120" align="center"></el-table-column>
                <el-table-column prop="Name" label="姓名" width="120" align="center"></el-table-column>

                <single_table_operation>
                    <template #default="scope">@(Html.Raw(ViewBag.PageFuncs("table")))</template>
                </single_table_operation>
            </template>
        </single_table>
        <component is="@(ViewBag.GetCompName("form"))" ref="formRef" v-on:refresh="refresh"></component>
    </div>
</template>
<script type="text/javascript">
    var @(ViewBag.PageName) = {
        template: "#@(ViewBag.PageTemplate)", data() {
            return {
                path: "@(ViewBag.PagePath)",
                searchColumns: [
                    { title: "开始时间", prop: "start", type: "date", default: "@(DateTime.Now.AddDays(-7).ToString("yyyy-MM-dd"))", auto: true, noClearable: true },
                    { title: "结束时间", prop: "end", type: "date", default: "@(DateTime.Now.ToString("yyyy-MM-dd"))", auto: true, noClearable: true },
                    {
                        title: "请求类型", prop: "method", type: "select", auto: true,
                        enums: [
                            { value: "GET", label: "GET" },
                            { value: "POST", label: "POST" }
                        ]
                    },
                    { title: "请求地址", prop: "url" },
                    { title: "来源IP", prop: "ip" },
                    { title: "BrowserType", prop: "browser" },
                    { title: "ContentType", prop: "contentType" },
                    { title: "正文内容", prop: "body" },
                    { title: "用户关联", prop: "user", placeholder: "输入编号或名称查询" }
                ]
            }
        },
        methods: {
            init(){
                var that = this;
            },
            refresh(){
                this.$refs.tableRef.loadData();
            },
            excel(){

            }
        },
        mounted() { this.init(); }
    };
</script>